package com.sysu.homework.service.Impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.sysu.homework.DAO.TeacherDAO;
import com.sysu.homework.model.Teacher;
import com.sysu.homework.service.TeacherService;

@Component("teacherService")
public class TeacherServiceImpl implements TeacherService {
	private TeacherDAO teacherDAO;

	@Override
	public Teacher getTeacherById(int id) {
		if (id != 0)
			return teacherDAO.getTeacherById(id);
		return null;
	}
	
	@Resource
	public void setTeacherDAO(TeacherDAO teacherDAO) {
		this.teacherDAO = teacherDAO;
	}

	public TeacherDAO getTeacherDAO() {
		return teacherDAO;
	}

	@Override
	public boolean isVaild(int id, String password) {
		if (id!=0 && password !=null)
			return teacherDAO.isValid(id, password);
		return false;
	}

	

}
